e
#Title[uMƕ`e͗lv]
#Text[Eς[
uMƕ`e͗lv]
#BackGround[User]
#BGM[.\..\bgm\bgm.wav]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
	
	////////////////////////////////////////////////////////////////////////
	//                                                          //
	//   e摜̕ύX                                                     //
	////////////////////////////////////////////////////////////////////////
	
	let color=[_RED03(),_ORANGE03(),_YELLOW03(),_GREEN03(),_AQUA03(),_BLUE03(),_PURPLE03()];
	
	@Initialize{
		InitializeData();
		
		LoadUserShotData(shot_ryoyan);
		
		SetLife(10);
		SetMovePosition03(GetCenterX(),GetCenterY()-200,10,8);
		//SetDamageRate(22,16);
		//SetInvincibility(240);
		//SetCollisionEx(32,16);
		SetEnemyMarker(false);
		
		SetDurableSpellCard();
		
		SetShotAutoDeleteClip(128,128,128,128);
		
		TMain();
	}
	
	@MainLoop{
		yield;
	}
	
	@DrawLoop{
		SetAlpha(128);
		DrawBoss(imgBoss);
	}
	
	@Finalize{
		FinalizeData();
		SetShotAutoDeleteClip(64,64,64,64);
	}
	
	task TMain(){
		wait(60);
		
		DeclareSpell();
		
		Atack();
		Move();
	}
	
	function DeclareSpell(){
		SetTimer(64);
		CutIn(YOUMU,"uMƕ`e͗lv",NULL,0,0,0,0);
		SetScore(1000000);
		wait(180);
	}
	
	task Atack(){
		let spd=0.2;
		let time=[60,40,20];
		let loopcount=[20,30,60];
		let count=0;
		ascent(lank in 0..3) {
			loop(loopcount[lank]) {
				let ang=GetAngleToPlayer()+count*360/14;
				PT(GetX(),GetY(),ang,spd);
				count++;
				loop(time[lank]) {yield;}
			}
		}
	}
	
	function PT(let x,let y,let ang,let spd) {
		task aaa(id,time) {
			let count=0;
			let x=Obj_GetX(id);
			let y=Obj_GetY(id);
			let ang=Obj_GetAngle(id);
			while(Obj_BeDeleted(id)==false && count<90) {
				let len=sin(count*2)*140;
				Obj_SetPosition(id,x+cos(ang)*len,y+sin(ang)*len);
				count++;
				yield;
			}
		}
		ascent(i in 0..7) {
			let ang2=ang+i*360/7;
			let id=CreateShot02(x,y,0,ang2,spd*0.02,spd,color[i],90);
			aaa(id,300);
		}
	}
	
	task Move(){
		while( GetEnemyLife() > 0 ) {
			SetMovePosition03(GetPlayerX(),GetPlayerY(),30,5);
			wait(20);
		}
	}
	
	#include_function ".\..\functions\initialize.txt"
	#include_function ".\..\functions\color_set.txt"
	#include_function ".\..\functions\function.txt"
}
